﻿<%@ Page Title="List of Beaches" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="List.aspx.vb" Inherits="BeachesInGreece.BeachesList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="aside2">
    <h2>Search</h2>
    <asp:textbox id="tb_search" runat="server"/>
    <br/>
    <br/>
    <asp:button id="btn_findByName" runat="server" text="By Name"/>
    <asp:button id="btn_findByRegion" runat="server" text="By Region"/>
    <br />
    <br />
    <b>Get Rss Feed here :</b>
        <ul>
            <li><a id="A1" runat="server" href="~/Rss.aspx">Rss</a></li>
        </ul>
    </div>
    <div class="mainDiv2">
    <h2 id="myHeading" runat="server"></h2>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
        OnRowCreated="OnRowCreated" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:BoundField DataField="BeachName" HeaderText="Beach" 
                SortExpression="BeachName">
            <ItemStyle Width="150px" />
            </asp:BoundField>
            <asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region">
            <ItemStyle Width="150px" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="BeachName" 
                DataNavigateUrlFormatString="https://maps.google.com/maps?q={0} + beach" 
                HeaderText="Location" DataTextField="Location">
            <ItemStyle Width="150px" />
            </asp:HyperLinkField>
            <asp:TemplateField HeaderText="Picture">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "Details.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="100" height="100" style="border-style: solid; border-width: medium" />
                    </asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BeachesDatabaseConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:BeachesDatabaseConnectionString.ProviderName %>" 
        
            SelectCommand="SELECT [ID], [BeachName], [Region], [Thumbnail], [Location] FROM [BeachesDatabase]"></asp:SqlDataSource>
 
   </div>
    
</asp:Content>
